package arithmetic.other;

/**
 * @author zhangyanqi
 * @since 1.0 2018/3/20
 * 翻转字符串
 */
public class ReverseString {

    static String reverse(String s) {
        if (s.length() == 1) {
            return s;
        }
        String first = s.substring(0, 1);
        return reverse(s.substring(1)) + first;
    }

    public static void main(String[] args) {


        String reverse = reverse("123");
        System.out.println(reverse);
    }


}
